<template>
  <div class="left-chart-3">
    <div class="lc1-header">技术领域信息</div>
    <!--<div class="lc3-details">学院转化成果总数<span>245</span></div>-->
    <dv-capsule-chart class="lc3-chart" :config="config" />
  </div>
</template>

<script>
  import { zhuantopfive } from "@/api/module/gs/dashuju";

  export default {
    name: 'LeftChart3',
    data () {
      return {
        config: {

          colors: ['#00baff', '#3de7c9', '#fff', '#ffc530', '#469f4b'],
          unit: '个',

        },
        firstname:0,
        firstvalue:0,

        twoname:0,
        twovalue:0,

        threename:0,
        threevalue:0,

        fourname:0,
        fourvalue:0,

        fivename:0,
        fivevalue:0,
      }
    },
    created() {
      this.getCount();
      this.$watch(
        () => [this.firstname, this.firstvalue, this.twoname,this.twovalue],
        () => {
          this.createData();
        }
      );
    },
    methods: {
      /** 查询成果总数 */
      getCount() {
        this.loading = true;
        zhuantopfive(this.queryParams).then(response => {
          this.firstname=Object.keys(response)[0];
          this.firstvalue=Object.values(response)[0];

          this.twoname=Object.keys(response)[1];
          this.twovalue=Object.values(response)[1];

          this.threename=Object.keys(response)[2];
          this.threevalue=Object.values(response)[2];

          this.fourname=Object.keys(response)[3];
          this.fourvalue=Object.values(response)[3];

          this.fivename=Object.keys(response)[4];
          this.fivevalue=Object.values(response)[4];
        });
      },

      createData () {
        const { randomExtend } = this

        this.config = {
          data: [
            {
              name: "新能源",
              value: this.firstvalue
            },
            {
              name:  "新兴信息产业",
              value: this.twovalue
            },
            {
              name:  "节能环保",
              value: this.threevalue
            },
            {
              name: "高端装备制造业",
              value: this.fourvalue
            },
            {
              name: "新材料",
              value: this.fivevalue
            },{
              name:  "生物产业",
              value: this.threevalue
            },
            {
              name: "新医药",
              value: this.fourvalue
            },
            {
              name:"新化工",
              value: this.fivevalue
            },  {
              name: "其他",
              value: this.fivevalue
            }
          ],
        }
      },


    }
  }
</script>

<style lang="less">
.left-chart-3 {
  width: 90%;
  height:60%;
  display: flex;
  flex-direction: column;

  .lc3-header {
    height: 20px;
    line-height: 20px;
    font-size: 16px;
    text-indent: 20px;
    margin-top: 10px;
  }

  .lc3-details {
    height: 40px;
    font-size: 16px;
    display: flex;
    align-items: center;
    text-indent: 20px;

    span {
      color: #096dd9;
      font-weight: bold;
      font-size: 35px;
      margin-left: 20px;
    }
  }
  .lc1-header {
    text-align: center;

    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 28px;
    margin-bottom: 20px;
  }
  .lc3-chart {
    flex: 1;
  }
}
</style>
